﻿<!DOCYPTE html>

<html>
  
 <body>
 
   <p>1、'body'中的 JavaScript <p>
   <script>
      alert("My First JavaScript");
      document.write("<h1> This is a heading</h1>")
      document.write("<p>This is a paragraph</p>")
      document.write("<p>My First JavaScript</p>")	  
   </script>
   
   <p>2、”head“ 中的 JavaScript 函数<p>
   <h1> My Web Page<h1>
     <p id="demo"> A Paragraph</p>
	 <script src="jsdir/myScript.js"></script> 
	 <button type="button" onclick="myFunction()">Try it</button>
      
	 
	 <button onclick="warnFunction()">点击这里</button>
	  <script>
	   function warnFunction(){
	    document.write("糟糕!文档消失了。");
	   }
	   </script>
	 
	
	    
	
 </body>
<html>